#ifndef __AL_OD__
#define __AL_OD__
#include <stdint.h>
typedef enum{
  AL_OnReq_Idle_0,
  AL_Build_DL_Service_1,
  AL_Await_DL_Param_cnf_2,
  AL_Await_DL_ISDU_cnf_3,
  AL_Build_AL_cnf_4
}AL_OD_STATE_TYPE;

typedef enum{
  AL_R,
  AL_W
}AL_Direction_TYPE;
typedef struct{
  
  uint8_t DirectAddress; //Page地址
  uint8_t   Data[16]; //由于可能存在整段读写，所以不能为指针类型
    uint8_t  Data_Pointer;// 数据指针，Data数组下标
    uint8_t  DataLen;//用于区分是读取单参数，还是整体读写
}AL_PAGE_STRUCT_TYPE; //PAGE通道参数类型
 

typedef struct{
   
  uint8_t Index;
  uint16_t Subindex;
  uint8_t  *Data;
  uint8_t DataLen;
}AL_ISDU_STRUCT_TYPE; //ISDU通道参数类型
extern AL_ISDU_STRUCT_TYPE AL_ISDU_STRUCT; //ISDU通道参数

 

typedef enum{
  Y_ISDU_Flag,
  N_ISDU_Flag,
  None_Flag
}ISDU_Flag_TYPE;
 

 


extern AL_OD_STATE_TYPE AL_OD_STATE; //AL_OD状态机状态

extern AL_ISDU_STRUCT_TYPE AL_ISDU_STRUCT; //ISDU通道参数

extern AL_PAGE_STRUCT_TYPE AL_PAGE_STRUCT; //PAGE通道参数
 

extern ISDU_Flag_TYPE ISDU_Flag;  //标示使用ISDU通道,根据Device特性得到

/**********构造Cnf参数**************/
extern uint8_t Current_Port; //当前端口
extern uint16_t AL_ErrorInfo; //AL层的Error信息
extern AL_Direction_TYPE AL_Dirction; //AL_Cnf方向
extern uint8_t * AL_ReadData;//AL_Cnf读取的数据
extern uint8_t   AL_ReadDataLen; //AL_Cnf读取的数据长度

void Event_AL_Service(uint8_t Port);
void Event_AL_Write(void);
void Event_AL_Read(void);

//Data为已经从ISDUBufferIn中提取的有效数据数据，
void Event_DL_ISDUTransport_Cnf(uint8_t * Data,uint8_t DataLen, uint16_t ErrorInfo);
void Event_DL_WriteParam_Cnf(uint16_t ErrorInfo);
void Event_DL_ReadParam_Cnf(uint8_t  Data,uint16_t ErrorInfo);

#endif
